/*
 * Image_dir.h
 *
 *  Created on: May 10, 2010
 *      Author: Soheil Damangir
 */

#ifndef IMAGE_DIR_H_
#define IMAGE_DIR_H_
#include<stdio.h>
#include<cstdlib>
#include<iostream>
#include<string.h>
#include<fstream>
#include<dirent.h>
#include "image.h"
using namespace kthrobot;

class Dir_Iter{
  DIR *pDIR;
  struct dirent *entry;
  char dir[256];
  char last_file[256];
  char last_file_name[256];
public:
  Dir_Iter(const char*dir = "");
  void reset();
  void open_dir(const char*dir);
  char* get_next_file();
  char* get_last_file(){return last_file;}
  char* get_entry_name(){return last_file_name;}
  virtual ~Dir_Iter();
};

class Image_Iter{
  Dir_Iter diter;
  Image image;
public:
  Image_Iter(const char* dir = "");
  void open_dir(const char* dir);
  Image* next_image();
  Dir_Iter&get_diter() {return diter;}
  static Image_Iter&get()
    {
      static Image_Iter instance;
      return instance;
    }
};

#endif /* IMAGE_DIR_H_ */
